package org.xtb.BS.dao;

import org.apache.ibatis.annotations.*;
import org.xtb.pojo.Contacts;

import java.util.List;

@Mapper
public interface ContactsDao {
    @Select("SELECT * FROM contacts")
    List<Contacts> queryAll();

    @Insert("INSERT INTO contacts (name, address, phone) VALUES (#{name}, #{address}, #{phone})")
    int insertOne(@Param("name") String name,@Param("address")String address,@Param("phone")String phone);

    @Update("UPDATE contacts SET name = #{name}, address = #{address}, phone = #{phone} WHERE id = #{id}")
    int updateOne(@Param("name")String name,@Param("address")String address,@Param("phone")String phone,@Param("id")int id);

    @Delete("DELETE FROM contacts WHERE id = #{id}")
    int deleteOne(@Param("id")int id);
}
